

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pyamp.web.html.baseElement &mdash; pyamp v1.2 documentation</title>
    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../../',
        VERSION:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
    <link rel="top" title="pyamp v1.2 documentation" href="../../../../index.html" />
    <link rel="up" title="Module code" href="../../../index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../../../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="../../../index.html" accesskey="U">Module code</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <h1>Source code for pyamp.web.html.baseElement</h1><div class="highlight"><pre>
<span class="c"># Copyright 2012 Brett Ponsler</span>
<span class="c"># This file is part of pyamp.</span>
<span class="c">#</span>
<span class="c"># pyamp is free software: you can redistribute it and/or modify</span>
<span class="c"># it under the terms of the GNU General Public License as published by</span>
<span class="c"># the Free Software Foundation, either version 3 of the License, or</span>
<span class="c"># (at your option) any later version.</span>
<span class="c">#</span>
<span class="c"># pyamp is distributed in the hope that it will be useful,</span>
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span class="c"># GNU General Public License for more details.</span>
<span class="c">#</span>
<span class="c"># You should have received a copy of the GNU General Public License</span>
<span class="c"># along with pyamp.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
<span class="kn">from</span> <span class="nn">pyamp.util</span> <span class="kn">import</span> <span class="n">filterNone</span>


<div class="viewcode-block" id="CloseTagType"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.CloseTagType">[docs]</a><span class="k">class</span> <span class="nc">CloseTagType</span><span class="p">:</span>
    <span class="n">NoTag</span> <span class="o">=</span> <span class="s">&quot;NoCloseTag&quot;</span>
    <span class="n">Separate</span> <span class="o">=</span> <span class="s">&quot;SeparateCloseTag&quot;</span>
    <span class="n">Joined</span> <span class="o">=</span> <span class="s">&quot;JoinedCloseTag&quot;</span>

</div>
<div class="viewcode-block" id="BaseHtmlElement"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.BaseHtmlElement">[docs]</a><span class="k">class</span> <span class="nc">BaseHtmlElement</span><span class="p">:</span>
    <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
    <span class="n">closeTagType</span> <span class="o">=</span> <span class="n">CloseTagType</span><span class="o">.</span><span class="n">Separate</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__properties</span> <span class="o">=</span> <span class="p">{}</span> <span class="k">if</span> <span class="n">properties</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">properties</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__elements</span> <span class="o">=</span> <span class="p">[]</span> <span class="k">if</span> <span class="n">elements</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">elements</span>

<div class="viewcode-block" id="BaseHtmlElement.toHtml"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.BaseHtmlElement.toHtml">[docs]</a>    <span class="k">def</span> <span class="nf">toHtml</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">spacing</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span>

        <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__getStartTag</span><span class="p">(</span><span class="n">spacing</span><span class="p">)</span>
        <span class="n">subElements</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__getSubElements</span><span class="p">(</span><span class="n">spacing</span> <span class="o">+</span> <span class="s">&quot;    &quot;</span><span class="p">)</span> 
        <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__getEndTag</span><span class="p">(</span><span class="n">spacing</span><span class="p">)</span>

        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">subElements</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">start</span><span class="p">)</span>
            <span class="n">lines</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">subElements</span><span class="p">)</span>

            <span class="k">if</span> <span class="n">end</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">end</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">end</span> <span class="o">=</span> <span class="s">&quot;&quot;</span> <span class="k">if</span> <span class="n">end</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">end</span>
            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">start</span> <span class="o">+</span> <span class="n">end</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>

        <span class="n">lines</span> <span class="o">=</span> <span class="n">filterNone</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span>
        <span class="k">return</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span>
</div>
    <span class="k">def</span> <span class="nf">__getStartTag</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">spacing</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">isNotJoined</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">closeTagType</span> <span class="o">!=</span> <span class="n">CloseTagType</span><span class="o">.</span><span class="n">Joined</span>
        <span class="n">endTag</span> <span class="o">=</span> <span class="bp">None</span> <span class="k">if</span> <span class="n">isNotJoined</span> <span class="k">else</span> <span class="s">&quot;/&quot;</span>
        <span class="n">parts</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">__getProperties</span><span class="p">(),</span> <span class="n">endTag</span><span class="p">]</span>

        <span class="c"># Filter out any values that are None</span>
        <span class="n">parts</span> <span class="o">=</span> <span class="n">filterNone</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span>

        <span class="k">return</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&lt;</span><span class="si">%s</span><span class="s">&gt;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">spacing</span><span class="p">,</span> <span class="s">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">parts</span><span class="p">))</span>

    <span class="k">def</span> <span class="nf">__getProperties</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">properties</span> <span class="o">=</span> <span class="p">[]</span>

        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">__properties</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">propStr</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">=&#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">propStr</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">key</span>

            <span class="n">properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">propStr</span><span class="p">)</span>

        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">properties</span> <span class="o">=</span> <span class="s">&#39; &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">properties</span> <span class="o">=</span> <span class="bp">None</span>

        <span class="k">return</span> <span class="n">properties</span>

    <span class="k">def</span> <span class="nf">__getSubElements</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">spacing</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="k">return</span> <span class="p">[</span><span class="n">el</span><span class="o">.</span><span class="n">toHtml</span><span class="p">(</span><span class="n">spacing</span><span class="p">)</span> <span class="k">for</span> <span class="n">el</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">__elements</span><span class="p">]</span>

    <span class="k">def</span> <span class="nf">__getEndTag</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">spacing</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">closeTag</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&lt;/</span><span class="si">%s</span><span class="s">&gt;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">spacing</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>

        <span class="n">isSeparate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">closeTagType</span> <span class="o">==</span> <span class="n">CloseTagType</span><span class="o">.</span><span class="n">Separate</span>
        <span class="k">return</span> <span class="bp">None</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">isSeparate</span> <span class="k">else</span> <span class="n">closeTag</span>

</div>
<div class="viewcode-block" id="HtmlFiveDoctype"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.HtmlFiveDoctype">[docs]</a><span class="k">class</span> <span class="nc">HtmlFiveDoctype</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;!DOCTYPE&quot;</span>
    <span class="n">closeTagType</span> <span class="o">=</span> <span class="n">CloseTagType</span><span class="o">.</span><span class="n">NoTag</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">properties</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;html&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">}</span>
        <span class="n">BaseHtmlElement</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Div"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Div">[docs]</a><span class="k">class</span> <span class="nc">Div</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;div&quot;</span>

</div>
<div class="viewcode-block" id="Html"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Html">[docs]</a><span class="k">class</span> <span class="nc">Html</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;html&quot;</span>

</div>
<div class="viewcode-block" id="Title"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Title">[docs]</a><span class="k">class</span> <span class="nc">Title</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;title&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">properties</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;title&#39;</span><span class="p">:</span> <span class="n">title</span><span class="p">}</span>
        <span class="n">BaseHtmlElement</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Head"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Head">[docs]</a><span class="k">class</span> <span class="nc">Head</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;head&quot;</span>

</div>
<div class="viewcode-block" id="Body"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Body">[docs]</a><span class="k">class</span> <span class="nc">Body</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;body&quot;</span>

</div>
<div class="viewcode-block" id="Text"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Text">[docs]</a><span class="k">class</span> <span class="nc">Text</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">content</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_content</span> <span class="o">=</span> <span class="n">content</span>
        <span class="n">BaseHtmlElement</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<div class="viewcode-block" id="Text.toHtml"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Text.toHtml">[docs]</a>    <span class="k">def</span> <span class="nf">toHtml</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">spacing</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="k">return</span> <span class="s">&quot;</span><span class="si">%s%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">spacing</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_content</span><span class="p">)</span>

</div></div>
<div class="viewcode-block" id="Anchor"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Anchor">[docs]</a><span class="k">class</span> <span class="nc">Anchor</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;a&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">href</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">properties</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">properties</span> <span class="o">=</span> <span class="p">{}</span> <span class="k">if</span> <span class="n">properties</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">properties</span>

        <span class="k">if</span> <span class="n">href</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">properties</span><span class="p">[</span><span class="s">&#39;href&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">href</span>

        <span class="n">BaseHtmlElement</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">,</span> <span class="n">elements</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Image"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Image">[docs]</a><span class="k">class</span> <span class="nc">Image</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;img&quot;</span>
    <span class="n">closeTagType</span> <span class="o">=</span> <span class="n">CloseTagType</span><span class="o">.</span><span class="n">Joined</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">src</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">properties</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">properties</span> <span class="o">=</span> <span class="p">{}</span> <span class="k">if</span> <span class="n">properties</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">properties</span>

        <span class="k">if</span> <span class="n">src</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">properties</span><span class="p">[</span><span class="s">&#39;src&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">src</span>

        <span class="n">BaseHtmlElement</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">,</span> <span class="n">elements</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Script"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Script">[docs]</a><span class="k">class</span> <span class="nc">Script</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;script&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">src</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">properties</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;src&#39;</span><span class="p">:</span> <span class="n">src</span><span class="p">}</span>
        <span class="n">BaseHtmlElement</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Link"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.Link">[docs]</a><span class="k">class</span> <span class="nc">Link</span><span class="p">(</span><span class="n">BaseHtmlElement</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;link&quot;</span>
    <span class="n">closeTagType</span> <span class="o">=</span> <span class="n">CloseTagType</span><span class="o">.</span><span class="n">Joined</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">href</span><span class="p">,</span> <span class="n">rel</span><span class="p">,</span> <span class="n">linkType</span><span class="p">):</span>
        <span class="n">properties</span> <span class="o">=</span> <span class="p">{</span>
            <span class="s">&#39;href&#39;</span><span class="p">:</span> <span class="n">href</span><span class="p">,</span>
            <span class="s">&#39;rel&#39;</span><span class="p">:</span> <span class="n">rel</span><span class="p">,</span>
            <span class="s">&#39;type&#39;</span><span class="p">:</span> <span class="n">linkType</span>
            <span class="p">}</span>

        <span class="n">BaseHtmlElement</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="CssLink"><a class="viewcode-back" href="../../../../_generated/pyamp_web_html_baseElement.html#pyamp.web.html.baseElement.CssLink">[docs]</a><span class="k">class</span> <span class="nc">CssLink</span><span class="p">(</span><span class="n">Link</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;link&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">href</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39; &#39;&#39;&#39;</span>
        <span class="n">link</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">href</span><span class="p">,</span> <span class="s">&quot;stylesheet&quot;</span><span class="p">,</span> <span class="s">&quot;text/css&quot;</span><span class="p">)</span>

</div>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">image</span><span class="p">(</span><span class="s">&quot;http://www.google.com/images/whatever.jpg&quot;</span><span class="p">)</span>
    <span class="n">content</span> <span class="o">=</span> <span class="n">text</span><span class="p">(</span><span class="s">&quot;Google&quot;</span><span class="p">)</span>
    <span class="n">link</span> <span class="o">=</span> <span class="n">anchor</span><span class="p">(</span><span class="n">href</span><span class="o">=</span><span class="s">&quot;http://www.google.com&quot;</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="p">[</span><span class="n">img</span><span class="p">,</span> <span class="n">content</span><span class="p">])</span>
    <span class="n">b</span> <span class="o">=</span> <span class="n">div</span><span class="p">({</span><span class="s">&quot;class&quot;</span><span class="p">:</span> <span class="s">&quot;hello&quot;</span><span class="p">},</span> <span class="n">elements</span><span class="o">=</span><span class="p">[</span><span class="n">link</span><span class="p">])</span>
    <span class="n">c</span> <span class="o">=</span> <span class="n">div</span><span class="p">(</span><span class="n">elements</span><span class="o">=</span><span class="p">[</span><span class="n">b</span><span class="p">])</span>
    <span class="n">d</span> <span class="o">=</span> <span class="n">div</span><span class="p">({</span><span class="s">&#39;id&#39;</span><span class="p">:</span> <span class="s">&quot;thisismyid&quot;</span><span class="p">},</span> <span class="n">elements</span><span class="o">=</span><span class="p">[</span><span class="n">c</span><span class="p">])</span>
    <span class="k">print</span> <span class="n">d</span><span class="o">.</span><span class="n">toHtml</span><span class="p">()</span>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../../../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="../../../index.html" >Module code</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>